#!/usr/bin/env python

from google.appengine.api import memcache

EXPIRE_TIME = 0

def getMemValue(value, key):
    try:
        data = memcache.get(key)
    except:
        data = None
        
    #get value, value is not null
    if value:
        if data is not None:
            _value = data
        else:
            memcache.add(key, value, EXPIRE_TIME)
            _value = value
    #get value, value is null
    else:
        if data is not None:
            _value = data
        else:
            _value = None
    
    return _value

